Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

distribute framework: add planner #46395

Merged
merged 16 commits into from
Sep 4, 2023
Merged

Conversation

GMHDBJD
Copy link
Contributor

@GMHDBJD GMHDBJD commented Aug 24, 2023

What problem does this PR solve?

Issue Number: ref #46258

Problem Summary:

What is changed and how it works?

  • logical plan -> task meta -> physical plan -> subtaskmetas -> operators.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@GMHDBJD
Copy link
Contributor Author

GMHDBJD commented Aug 24, 2023

/hold wip

@ti-chi-bot ti-chi-bot bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 24, 2023
@tiprow
Copy link

tiprow bot commented Aug 24, 2023

Hi @GMHDBJD. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@codecov
Copy link

codecov bot commented Aug 24, 2023

Codecov Report

Merging #46395 (e51275b) into master (1901239) will decrease coverage by 0.5213%.
Report is 7 commits behind head on master.
The diff coverage is 56.9230%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #46395        +/-   ##
================================================
- Coverage   73.3422%   72.8209%   -0.5213%     
================================================
  Files          1310       1335        +25     
  Lines        395127     403506      +8379     
================================================
+ Hits         289795     293837      +4042     
- Misses        86876      91197      +4321     
- Partials      18456      18472        +16     
Flag Coverage Δ
integration 25.7357% <0.0000%> (?)
unit 73.5263% <56.9230%> (+0.1840%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 54.0444% <ø> (ø)
parser 84.9628% <ø> (+0.0108%) ⬆️
br 48.1094% <ø> (-4.2312%) ⬇️

@ti-chi-bot ti-chi-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 24, 2023
@GMHDBJD
Copy link
Contributor Author

GMHDBJD commented Aug 29, 2023

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 29, 2023
@GMHDBJD
Copy link
Contributor Author

GMHDBJD commented Aug 29, 2023

/retest

@tiprow
Copy link

tiprow bot commented Aug 29, 2023

@GMHDBJD: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@GMHDBJD
Copy link
Contributor Author

GMHDBJD commented Aug 29, 2023

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label Aug 29, 2023
@GMHDBJD
Copy link
Contributor Author

GMHDBJD commented Aug 29, 2023

/test tiprow_fast_test

@ti-chi-bot
Copy link

ti-chi-bot bot commented Aug 29, 2023

@GMHDBJD: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test build
  • /test canary-scan-security
  • /test check-dev
  • /test check-dev2
  • /test mysql-test
  • /test pingcap/tidb/canary_ghpr_unit_test
  • /test pull-br-integration-test
  • /test pull-common-test
  • /test pull-e2e-test
  • /test pull-integration-common-test
  • /test pull-integration-copr-test
  • /test pull-integration-ddl-test
  • /test pull-integration-jdbc-test
  • /test pull-integration-mysql-test
  • /test pull-integration-prisma-test
  • /test pull-mysql-connector-test
  • /test pull-sqllogic-test
  • /test pull-tiflash-test
  • /test unit-test

The following commands are available to trigger optional jobs:

  • /test pull-notify-when-compatibility-sections-changed

Use /test all to run the following jobs that were automatically triggered:

  • pingcap/tidb/ghpr_build
  • pingcap/tidb/ghpr_check
  • pingcap/tidb/ghpr_check2
  • pingcap/tidb/ghpr_mysql_test
  • pingcap/tidb/ghpr_unit_test

In response to this:

/test tiprow_fast_test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ywqzzy
Copy link
Contributor

ywqzzy commented Aug 29, 2023

/cc @ywqzzy

@ti-chi-bot ti-chi-bot bot requested a review from ywqzzy August 29, 2023 09:34
if err != nil {
return nil, err
}
gTask.Step = nextStep
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can do gtask.Step++ in dispatcher after calling processNormalFlow.
Anyway, this refinement can be done later.

physicalPlan := &planner.PhysicalPlan{}
inputStreams := make([]planner.StreamSpec, 0)
// physical plan only needs to be generated once.
// However, our current implementation requires generating it for each step.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can we generate the physical plan once? Next pr?

Copy link
Contributor Author

@GMHDBJD GMHDBJD Aug 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we support pass result from one step two another step, then we only need generated the initial physical plan, all runtime arguments should be define in input stream and generate in executor instead

JobID int64
Plan importer.Plan
Stmt string
EligibleInstances []*infosync.ServerInfo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems useless?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EligibleInstances: instances,


// PreviousSubtaskMetas is a list of subtask metas from previous step.
// We can remove this field if we find a better way to pass the result between steps.
PreviousSubtaskMetas [][]byte
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hold task_table as member?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hold task_table as member?

The planner in tidb runtime also fetch meta data from tikv. So I think it's ok.

Copy link
Contributor Author

@GMHDBJD GMHDBJD Aug 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using PreviousSubtaskMetas is to express that PreviousSubtaskMetas is the result of the previous step. If we use task_table, our planner will be coupled with the system table again, although adding a new interface would be more convenient. 🤔

Streams []StreamSpec
}

// StreamSpec is the specification of a stream.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name is a little bit confusing, can we have a better name?


type mockPlan struct{}

func (mockPlan) ToTaskMeta() ([]byte, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can use gen_mock introduced in #46392

Comment on lines +46 to +47
store := testkit.CreateMockStore(t)
gtk := testkit.NewTestKit(t, store)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems useless? Bootstrap a testkit cost some resource, better not add it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need testkit to submit a global task like what we do in handle_test

gtk := testkit.NewTestKit(t, store)

}

// PhysicalPlan is a DAG of processors in distribute framework.
type PhysicalPlan struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add more detailed comments to show the arch of the planner?

@GMHDBJD
Copy link
Contributor Author

GMHDBJD commented Aug 31, 2023

/retest

Copy link
Contributor

@ywqzzy ywqzzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Aug 31, 2023
@GMHDBJD
Copy link
Contributor Author

GMHDBJD commented Aug 31, 2023

/retest

@GMHDBJD
Copy link
Contributor Author

GMHDBJD commented Aug 31, 2023

/test tiprow_fast_test

@ti-chi-bot
Copy link

ti-chi-bot bot commented Aug 31, 2023

@GMHDBJD: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test build
  • /test canary-scan-security
  • /test check-dev
  • /test check-dev2
  • /test mysql-test
  • /test pingcap/tidb/canary_ghpr_unit_test
  • /test pull-br-integration-test
  • /test pull-common-test
  • /test pull-e2e-test
  • /test pull-integration-common-test
  • /test pull-integration-copr-test
  • /test pull-integration-ddl-test
  • /test pull-integration-jdbc-test
  • /test pull-integration-mysql-test
  • /test pull-integration-prisma-test
  • /test pull-mysql-connector-test
  • /test pull-sqllogic-test
  • /test pull-tiflash-test
  • /test unit-test

The following commands are available to trigger optional jobs:

  • /test pull-notify-when-compatibility-sections-changed

Use /test all to run the following jobs that were automatically triggered:

  • pingcap/tidb/ghpr_build
  • pingcap/tidb/ghpr_check
  • pingcap/tidb/ghpr_check2
  • pingcap/tidb/ghpr_mysql_test
  • pingcap/tidb/ghpr_unit_test

In response to this:

/test tiprow_fast_test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@GMHDBJD
Copy link
Contributor Author

GMHDBJD commented Aug 31, 2023

/test tiprow_fast_test

@ti-chi-bot
Copy link

ti-chi-bot bot commented Aug 31, 2023

@GMHDBJD: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test build
  • /test canary-scan-security
  • /test check-dev
  • /test check-dev2
  • /test mysql-test
  • /test pingcap/tidb/canary_ghpr_unit_test
  • /test pull-br-integration-test
  • /test pull-common-test
  • /test pull-e2e-test
  • /test pull-integration-common-test
  • /test pull-integration-copr-test
  • /test pull-integration-ddl-test
  • /test pull-integration-jdbc-test
  • /test pull-integration-mysql-test
  • /test pull-integration-prisma-test
  • /test pull-mysql-connector-test
  • /test pull-sqllogic-test
  • /test pull-tiflash-test
  • /test unit-test

The following commands are available to trigger optional jobs:

  • /test pull-notify-when-compatibility-sections-changed

Use /test all to run the following jobs that were automatically triggered:

  • pingcap/tidb/ghpr_build
  • pingcap/tidb/ghpr_check
  • pingcap/tidb/ghpr_check2
  • pingcap/tidb/ghpr_mysql_test
  • pingcap/tidb/ghpr_unit_test

In response to this:

/test tiprow_fast_test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

type Planner struct{}

// Run runs the distribute plan.
func (*Planner) Run(planCtx PlanCtx, plan LogicalPlan) (int64, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No usage?

@GMHDBJD
Copy link
Contributor Author

GMHDBJD commented Sep 1, 2023

/retest

Copy link
Contributor

@D3Hunter D3Hunter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5/13 review later

@ti-chi-bot
Copy link

ti-chi-bot bot commented Sep 4, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tangenta, ywqzzy

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm approved and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 4, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Sep 4, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-08-31 09:45:18.488400438 +0000 UTC m=+2006683.037416425: ☑️ agreed by ywqzzy.
  • 2023-09-04 06:06:54.052178592 +0000 UTC m=+2339178.601194579: ☑️ agreed by tangenta.

@GMHDBJD
Copy link
Contributor Author

GMHDBJD commented Sep 4, 2023

/retest

@GMHDBJD
Copy link
Contributor Author

GMHDBJD commented Sep 4, 2023

/retest

@tiprow
Copy link

tiprow bot commented Sep 4, 2023

@GMHDBJD: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
tiprow_fast_test e51275b link true /test tiprow_fast_test

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@ti-chi-bot ti-chi-bot bot merged commit 6707afa into pingcap:master Sep 4, 2023
5 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test Indicates a PR is ready to be tested. release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants